<!DOCTYPE html>
<html class="k-webkit k-webkit99">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Hand Application Platform</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="_csrf" content="36ca4314-d960-42a9-b927-160ef0f857e2">
    <meta name="_csrf_header" content="X-CSRF-TOKEN">

    <script src="/wedding_admin/js/jquery.min.js"></script>
    <script src="/wedding_admin/js/kendo/kendo.all.min.js"></script>
    <script src="/wedding_admin/js/jszip.min.js"></script>
    <link href="/wedding_admin/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="/wedding_admin/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link href="/wedding_admin/css/um/kendo.common-bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="/wedding_admin/css/um/kendo.bootstrap.min.css" rel="stylesheet" type="text/css"/>

    <link href="/wedding_admin/css/um/kendo.hap.css" rel="stylesheet" type="text/css"/>
    <script src="/wedding_admin/js/kendo/kendo.culture.zh-CN.js"></script>
    <script src="/wedding_admin/js/kendo/kendo.messages.zh-CN.js"></script>
    <script src="/wedding_admin/js/kendo/kendo.hap.js"></script>
    <script src="/wedding_admin/js/bootstrap/jquery.blockui.min.js"></script>
    <script src="/wedding_admin/js/vue_table/vue.min.js"></script>
    <script src="/wedding_admin/js/vue_table/vue-validator.min.js"></script>

</head>
<body>


<style type="text/css">
    .file {
        position: relative;
        display: inline-block;
        background: #FFF;
        border: 1px solid #eaf4fc;
        border-radius: 4px;
        padding: 4px 12px;
        overflow: hidden;
        color: #004974;
        text-decoration: none;
        text-indent: 0;
        font-size: 10px;

    }

    .file input {
        position: absolute;
        right: 0;
        top: 0;
        opacity: 0;

    }

    .file:hover {
        background: #faf9f9;
        border-color: #FFF;
        color: #54565B;
        text-decoration: none;
    }

</style>


<div class="page-content" id="rrapp">
    <div class="form-horizontal" role="form" autocomplete="off">
        <div class="panel-body">
            <div class="row">
                <div class="form-group ">
                    <label class="col-sm-3 control-label">登陆系统标题</label>
                    <div class="col-sm-4">
                        <input class=" k-textbox" id="sys_title" style="width: 100%">

                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="form-horizontal">
        <div class="panel-heading">
            <span class="panel-title"> 样式</span>
        </div>
        <div class="panel-body">
            <div class="row">

                <div class="form-group">
                    <label class="col-md-3 control-label">Login图</label>
                    <div class="col-md-4">
                        <img id="sys-logo-img" name="logo" width="100" class="pull-left" src=""
                             style="border:1px solid #ccc;">
                        <!--TODO----上线地址需改变-->
                        <form id="upload-logo-form"
                              action="http://localhost:9001/wedding_admin/sys/sysdict/logoImgUpdete"
                              target="_uploadTarget" enctype="multipart/form-data" method="POST" class="pull-left"
                              style="padding-left:20px;">
                            <input type="hidden" value="dltp" name="imGcode"/>
                            <a href="javascript:void(0);" class="file btn">
                                选择文件 <input type="file" name="sys-logo-img-uploader"
                                            onchange="preview(this,'sys-logo-img');">
                            </a>

                            <button type="submit" class="btn btn-success">
                                上传
                            </button>
                            <small class="help-block"> 上传图片大小建议为100 * 70 px</small>
                        </form>
                    </div>
                </div>
            </div>
            <div class="row" style="margin-top:10px;">
                <div class="form-group">
                    <label class="col-md-3 control-label">favicon</label>
                    <div class="col-md-4">
                        <img id="sys-favicon-img" name="favicon" class="pull-left" src="" width="32" height="32"
                             style="border:1px solid #ccc">
                        <!--TODO----上线地址需改变-->
                        <form id="upload-icon-form"
                              action="http://localhost:9001/wedding_admin/sys/sysdict/logoImgUpdete"
                              target="_uploadTarget" enctype="multipart/form-data" method="POST" class="pull-left"
                              style="padding-left:88px;">
                            <input type="hidden" value="ltp" name="imGcode"/>
                            <a href="javascript:void(0);" class="file btn">
                                选择文件 <input type="file" accept="image/*" name="sys-logo-img-uploader" id="favicon"
                                            onchange="preview(this,'sys-favicon-img');">
                            </a>
                            <button type="submit" class="btn btn-success">
                                上传
                            </button>
                            <small class="help-block">上传图片大小建议为32 * 32 px</small>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="form-horizontal">
        <div class="panel-heading">
            <span class="panel-title"> 安全策略</span>
        </div>
        <div class="panel-body">

            <div class="row">
                <div class="form-group">
                    <label class="col-md-3 control-label">验证码</label>
                    <div class="col-md-4">
                        <div class="form-check">
                            <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1"
                                   value="0" checked>
                            <label class="form-check-label" for="exampleRadios1">
                                禁用验证码
                            </label>
                        </div>
                        <div class="form-check">
                            <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2"
                                   value="1">
                            <label class="form-check-label" for="exampleRadios2">
                                启用验证码
                            </label>
                        </div>
                    </div>

                </div>
            </div>

        </div>
    </div>

    <div class="form-horizontal">
        <div class="panel-heading">
            <span class="panel-title">密码策略</span>
        </div>
        <div class="panel-body">

            <div class="row">
                <div class="form-group">
                    <label class="col-md-3 control-label">新用户默认密码</label>
                    <div class="col-md-4">
                        <input class=" k-textbox" id="default_password" data-bind="value:model.default_password"
                               style="width: 50%">
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group">
                    <label class="col-md-3 control-label">密码最小长度</label>
                    <div class="col-md-4">
                        <span class="k-widget k-numerictextbox k-header" style="width: 50%;">
                            <span class="k-numeric-wrap k-state-default">
                                <input type="text" class="k-formatted-value k-input"
                                       id="ac333e46-5d4e-425d-b036-bdcd8d5ab24b" title="8" tabindex="0"
                                       role="spinbutton" aria-valuemin="6" aria-valuemax="16" aria-title="8"
                                       aria-valuenow="8" aria-disabled="false" aria-readonly="false"
                                       style="display: inline-block;">
                                <input type="text" onkeyup="this.value=this.value.replace(/\D/gi,'')" value="8" max="16"
                                       min="6" id="password_min_length" data-bind="value:model.password_min_length"
                                       style="display: none;" onchange="passwordlength();" data-role="numerictextbox"
                                       role="spinbutton" aria-valuemin="6" aria-valuemax="16" class="k-input"
                                       aria-valuenow="8" aria-disabled="false" aria-readonly="false">
                                <span class="k-select"><span unselectable="on" class="k-link k-link-increase"
                                                             aria-label="增加" title="增加"
                                                             style="touch-action: none;"><span unselectable="on"
                                                                                               class="k-icon k-i-arrow-n"></span></span><span
                                        unselectable="on" class="k-link k-link-decrease" aria-label="减少" title="减少"
                                        style="touch-action: none;"><span unselectable="on"
                                                                          class="k-icon k-i-arrow-s"></span></span></span></span></span>

                    </div>
                </div>
            </div>
            <div class="row">
                <div class="form-group">
                    <label class="col-md-3 control-label">密码复杂度要求</label>
                    <div class="col-md-4">
                        <span title="" class="k-widget k-dropdown k-header" unselectable="on" role="listbox"
                              aria-haspopup="true" aria-expanded="false" tabindex="0"
                              aria-owns="password_complexity_listbox" aria-disabled="false" aria-busy="false"
                              aria-activedescendant="1a33f189-50c7-429c-a27c-cab8bf8e0061" style="width: 50%;"><span
                                unselectable="on" class="k-dropdown-wrap k-state-default"><span unselectable="on"
                                                                                                class="k-input">无限制</span><span
                                unselectable="on" class="k-select" aria-label="select"><span
                                class="k-icon k-i-arrow-s"></span></span></span><select data-role="dropdownlist"
                                                                                        id="password_complexity"
                                                                                        data-value-primitive="true"
                                                                                        style="width: 50%; display: none;"
                                                                                        data-text-field="meaning"
                                                                                        data-value-field="value"
                                                                                        data-bind="source: passwordComplexityData, value: model.password_complexity"><option
                                value="no_limit">无限制</option><option value="digits_and_letters">必须混合数字和字母</option><option
                                value="digits_and_case_letters">必须混合数字和大小写字母</option></select></span>

                    </div>
                </div>
            </div>

        </div>
    </div>

    <div class="form-horizontal">
        <div class="panel-heading">
            <span class="panel-title">登录策略</span>
        </div>
        <div class="panel-body">

            <div class="row">
                <div class="form-group">
                    <label class="col-md-3 control-label">首次登陆修改密码</label>
                    <div class="col-xs-1" id="resetPWDiv">
                        <span tabindex="0" class="k-checkbox k-state-default" style="margin-top: 8px;"><input
                                id="resetPW" name="resetPW" style="margin-top: 8px; display: none;" type="checkbox"
                                data-bind="enabled: isEnabled,value:model.first_login_reset_password"
                                data-role="checkbox" value="N"></span>
                    </div>

                    <label class="col-xs-4 control-label" style="text-align:left;">首次登陆强制新用户修改密码</label>
                </div>
            </div>


            <div class="row">
                <div class="form-group">
                    <label class="col-md-3 control-label"></label>
                    <div class="col-md-4">
                        <span class="btn btn-primary" id="save" data-hotkey="hotkey_save" style="width:100px"
                              @click="saveForm"><i class="fa fa-save" style="margin-right:3px;"></i>保存</span>

                    </div>
                </div>

            </div>
        </div>
    </div>


</div>
<div class="k-list-container k-popup k-group k-reset" id="password_complexity-list" data-role="popup"
     style="display: none; position: absolute;">
    <div class="k-group-header" style="display:none"></div>
    <div class="k-list-scroller" unselectable="on">
        <ul unselectable="on" class="k-list k-reset" tabindex="-1" aria-hidden="true" id="password_complexity_listbox"
            aria-live="off" data-role="staticlist" role="listbox">
            <li tabindex="-1" role="option" unselectable="on" class="k-item k-state-focused k-state-selected"
                data-offset-index="0" id="1a33f189-50c7-429c-a27c-cab8bf8e0061" aria-selected="true">无限制
            </li>
            <li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="1">必须混合数字和字母</li>
            <li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="2">必须混合数字和大小写字母</li>
        </ul>
    </div>
    <div class="k-nodata" style="display: none;">
        <div>No data found.</div>
    </div>
</div>

<script type="text/javascript">

    var vm = new Vue({
        el: '#rrapp',
        data: {

            roleList: {},
            dict: {}

        },
        mounted() {
            //初始化执行方法

            this.getImgPath()


        },
        methods: {

            getImgPath: function () {

                debugger
                $.ajax({
                    type: "GET",
                    url: "/wedding_admin/sys/sysdict/getimgpathlist",
                    contentType: "application/json",
                    success: function (r) {
                        console.log(JSON.stringify(r.imgList))
                        var faviconimg = "";
                        var logoimg = "";
                        for (var i = 0; i < r.imgList.length; i++) {
                            //登陆页面图片
                            if (r.imgList[i].code == "dltp") {

                                logoimg = r.imgList[i].value
                            }
                            //icon 图
                            if (r.imgList[i].code == "ltp") {
                                 faviconimg= r.imgList[i].value;
                            }
                            //标题
                            if (r.imgList[i].code == "dlbt") {

                                $('#sys_title').val(r.imgList[i].value);
                            }
                            //是否启用验证码
                            if (r.imgList[i].code == "yzm") {

                                $("input[name='exampleRadios'][value='" + r.imgList[i].value + "']").attr("checked", true);


                            }

                        }
                        $("#sys-favicon-img").attr("src", "/" + faviconimg);
                        $("#sys-logo-img").attr("src", "/" + logoimg);
                    }
                });

            },
            saveForm: function () {
                var bt = $('#sys_title').val();
                var yzm=""
                var obj = document.getElementsByTagName("input");
                for (var i = 0; i < obj.length; i++) {
                    if (obj[i].checked) {
                        yzm=obj[i].value

                    }
                }
                var dictList=new Array()
                dictList[0]=bt
                dictList[1]=yzm

                var url = "/wedding_admin/sys/sysdict/saveForm";
                  $.ajax({
                      type: "POST",
                      url: url,
                      contentType: "application/json",
                      data: JSON.stringify(dictList),
                      success: function (r) {
                          if (r.code === 0) {
                              alert('操作成功');
                              //刷新当前页面
                              location.reload();




                          } else {
                              alert(r.msg);
                          }
                      }
                  });
            }

        }
    })

    var preview = function (file, container) {

        var container = document.getElementById(container), path = '';
        if (file && file.files.length > 0) {
            //setTimeout('$("#file").select();', 1);
            if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
                file.select();
                if (window.getSelection) {
                    path = window.getSelection();
                } else if (window.document.getSelection) {
                    path = window.document.getSelection();
                } else if (window.document.selection) {
                    path = window.document.selection.createRange().text;
                }

            } else if (window.navigator.userAgent.indexOf("Firefox") >= 1) {
                if (file.files) {
                    path = window.URL.createObjectURL(file.files[0]);
                } else {
                    path = file.value;
                }
            } else if (window.navigator.userAgent.indexOf("Chrome") >= 1) {
                path = window.webkitURL.createObjectURL(file.files[0]);
            }

            container.src = path;
        }
    }




</script>

</body>
</html>
